<HTML>
<HEAD>
<TITLE>[Chapter 23] TextComponentPeer</TITLE>
<META NAME="author" CONTENT="John Zukowski">
<META NAME="date" CONTENT="Thu Jul 31 15:28:50 1997">
<META NAME="form" CONTENT="html">
<META NAME="metadata" CONTENT="dublincore.0.1">
<META NAME="objecttype" CONTENT="book part">
<META NAME="otheragent" CONTENT="gmat dbtohtml">
<META NAME="publisher" CONTENT="O'Reilly &amp; Associates, Inc.">
<META NAME="source" CONTENT="SGML">
<META NAME="subject" CONTENT="Java AWT">
<META NAME="title" CONTENT="Java AWT">
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript">
</HEAD>
<body vlink="#551a8b" alink="#ff0000" text="#000000" bgcolor="#FFFFFF" link="#0000ee">

<DIV CLASS=htmlnav>
<H1><a href='index.htm'><IMG SRC="gifs/smbanner.gif"
     ALT="Java AWT" border=0></a></H1>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch23_23.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><B><FONT FACE="ARIEL,HELVETICA,HELV,SANSERIF" SIZE="-1">Chapter 23<br>java.awt.peer Reference</FONT></B></TD>
<td width=172 align=right valign=top><A HREF="ch23_25.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
</table>

&nbsp;
<hr align=left width=515>
</DIV>
<DIV CLASS=refnamediv>
<H1>TextComponentPeer</H1>

<H2>Name</H2>

TextComponentPeer

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch23-REFSECT1-AUTOID.112"></A></h2>
</DIV>


<p>
<img align=middle src="./figs/textcom.gif" alt="[Graphic: Figure from the text]" width=502 height=136 border=0>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch23-REFSECT1-AUTOID.113">Description</A></h2>

<P CLASS=para>
<tt CLASS=literal>TextComponentPeer</tt> is an interface 
that defines the basis for text components. 

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch23-REFSECT1-AUTOID.114">Interface Definition</A></h2>

<DIV CLASS=screen>
<P>
<PRE>
public abstract interface java.awt.peer.TextComponentPeer
   extends java.awt.peer.ComponentPeer {
  // Interface Methods
  public abstract int getCaretPosition(); <img src="gifs/bstar.gif" alt="(New)" border=0>
  public abstract int getSelectionEnd();
  public abstract int getSelectionStart();
  public abstract String getText();
  public abstract void select (int selectionStart, int selectionEnd);
  public abstract void setCaretPosition (int pos); <img src="gifs/bstar.gif" alt="(New)" border=0>
  public abstract void setEditable (boolean state);
  public abstract void setText (String text);
}
</PRE>
</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch23-REFSECT1-AUTOID.115">Interface Methods</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch23-REFSECT2-AUTOID.100">getCaretPosition</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch23-REFSECT3-AUTOID.101">public abstract int getCaretPosition() <img src="gifs/bstar.gif" alt="(New)" border=0></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The current position of the caret (text cursor). </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch23-REFSECT2-AUTOID.101">getSelectionEnd</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch23-REFSECT3-AUTOID.102">public abstract int getSelectionEnd()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The ending cursor position of any selected text. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch23-REFSECT2-AUTOID.102">getSelectionStart</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch23-REFSECT3-AUTOID.103">public abstract int getSelectionStart()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The initial position of any selected text. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch23-REFSECT2-AUTOID.103">getText</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch23-REFSECT3-AUTOID.104">public abstract String getText()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The current contents of the text component's peer. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch23-REFSECT2-AUTOID.104">select</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch23-REFSECT3-AUTOID.105">public abstract void select (int selectionStart, int selectionEnd)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>selectionStart</I><br>
<DD>

<P CLASS=para>
Beginning 
position of the text to select.

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>selectionEnd</I><br>
<DD>

<P CLASS=para>
Ending position 
of the text to select. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Selects text in the text component's peer. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch23-REFSECT2-AUTOID.105">selectCaretPosition</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch23-REFSECT3-AUTOID.106">public abstract void selectCaretPosition (int pos)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>pos</I><br>
<DD>

<P CLASS=para>
New caret position. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Changes the position of the caret (text cursor). </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch23-REFSECT2-AUTOID.106">setEditable</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch23-REFSECT3-AUTOID.107">public abstract void setEditable (boolean state)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>state</I><br>
<DD>

<P CLASS=para>
<tt CLASS=literal>true</tt> 
if the user can change the contents of the text component's peer 
(i.e., <tt CLASS=literal>true</tt> to make the peer 
editable); <tt CLASS=literal>false</tt> to make the 
peer read-only. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Allows you to change the current editable state of the text component's 
peer. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch23-REFSECT2-AUTOID.107">setText</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch23-REFSECT3-AUTOID.108">public abstract void setText (String text)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>text</I><br>
<DD>

<P CLASS=para>
New text for the text 
component's peer . </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Sets the content of the text component's peer. </DL>
</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch23-REFSECT1-AUTOID.116">See Also</A></h2>

<P CLASS=para>
<tt CLASS=literal>ComponentPeer</tt>, <tt CLASS=literal>String</tt>, 
<tt CLASS=literal>TextAreaPeer</tt>, <tt CLASS=literal>TextFieldPeer</tt> 

</DIV>


<DIV CLASS=htmlnav>

<P>
<HR align=left width=515>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch23_23.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><a href="index.htm"><img src='gifs/txthome.gif' border=0 alt='Home'></a></td>
<td width=172 align=right valign=top><A HREF="ch23_25.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
<tr>
<td width=172 align=left valign=top>TextAreaPeer</td>
<td width=171 align=center valign=top><a href="index/idx_a.htm"><img src='gifs/index.gif' alt='Book Index' border=0></a></td>
<td width=172 align=right valign=top>TextFieldPeer</td>
</tr>
</table>
<hr align=left width=515>

<IMG SRC="gifs/smnavbar.gif" USEMAP="#map" BORDER=0> 
<MAP NAME="map"> 
<AREA SHAPE=RECT COORDS="0,0,108,15" HREF="../javanut/index.htm"
alt="Java in a Nutshell"> 
<AREA SHAPE=RECT COORDS="109,0,200,15" HREF="../langref/index.htm" 
alt="Java Language Reference"> 
<AREA SHAPE=RECT COORDS="203,0,290,15" HREF="../awt/index.htm" 
alt="Java AWT"> 
<AREA SHAPE=RECT COORDS="291,0,419,15" HREF="../fclass/index.htm" 
alt="Java Fundamental Classes"> 
<AREA SHAPE=RECT COORDS="421,0,514,15" HREF="../exp/index.htm" 
alt="Exploring Java"> 
</MAP>
</DIV>

</BODY>
</HTML>
